/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Client.gui;

import java.awt.Graphics2D;

/**
 *
 * @author Ripper
 */
public abstract class Effect 
{
    private long timetolive;
    private long startTime;
    
    public Effect(long ttl)
    {
        timetolive = ttl;
        startTime = System.currentTimeMillis();
    }
    
    public boolean isAlive()
    {
        return (startTime + timetolive > System.currentTimeMillis());
    }

    public long getTimetolive() {
        return timetolive;
    }

    public void setTimetolive(long timetolive) {
        this.timetolive = timetolive;
    }
    
    public int getLifespanPrct()
    {
        int timeAlive = (int)(System.currentTimeMillis() - startTime);
        return (int)((timeAlive * 100) / timetolive);
    }
    
    public abstract void draw(Graphics2D g);
}
